#ifndef __BSP_SPI_H__
#define __BSP_SPI_H__
#include "bsp_gpio.h"
#include "bsp_define.h"
#include "sym32l010_hal_spi.h"
#define TX_LEN 100
#define RX_LEN 100

typedef struct
{
    bsp_gpio_init_t *cs_pin;
    bsp_gpio_init_t *sck_pin;
    bsp_gpio_init_t *mosi_pin;
    bsp_gpio_init_t *miso_pin;
    uint8_t div;
    uint8_t cpha;
    uint8_t cpol;
    uint8_t datawidth;
    uint8_t mode;
    uint8_t firstbit;
    uint8_t duplex;
    uint8_t cs_mode;
    uint8_t *txbuf;
    uint8_t *rxbuf;
} bsp_spi_init_t;


extern uint8_t SPI1_txbuf[TX_LEN],SPI1_rxbuf[RX_LEN];

int32_t bsp_Spi_Init(bsp_spi_init_t *spi_instance);
int32_t bsp_Spi_DeInit(bsp_spi_init_t *spi_instance);
int32_t bsp_spi_transmit(bsp_spi_init_t *spi_instance, uint8_t *tx_buf, uint8_t *rx_buf, uint16_t len);
#endif /* __BSP_SPI_H__ */

